﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace SkiTracker.Converter
{
    public class UtcToLocalDateTimeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is DateTime)
            {
                return TimeZoneInfo.ConvertTime((DateTime) value, TimeZoneInfo.Local);
            }
            return DependencyProperty.UnsetValue;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}